package embeded.impl;

import java.rmi.RemoteException;

import agent.impl.AgentImpl;


import topic.Topic;
import embeded.EmbededObject;

public class EmbededObjectImpl implements EmbededObject{
	private String objectName = null;
	private AgentImpl agent = null;
	private boolean refresh = false;
	private boolean endNotify = false;
	private boolean isBusy = false;
	
	public EmbededObjectImpl() {
		agent = new AgentImpl(this);
	}

	public String getObjectUserName() throws RemoteException {
		return objectName;
	}

	public boolean beginUsing(String topicFullName) throws RemoteException {
		this.objectName = topicFullName;
		return agent.doMulticast();
	}

	public void setData(Object data) throws RemoteException {
		agent.setData(data);
	}

	public Object getData() throws RemoteException {
		return agent.getData();
	}

	public void endUsing() throws RemoteException {
		
	}

	public boolean isRefresh() throws RemoteException {
		return refresh;
	}

	public void setRefresh(boolean refresh) throws RemoteException {
		this.refresh = refresh;
	}

	public boolean isEndUsingNotify() throws RemoteException {
		return endNotify;
	}
	
	public boolean isBusy() throws RemoteException{
		return isBusy;
	}
	
	public void setBusy(boolean busy) throws RemoteException{
		isBusy = busy;
	}

}
